package com.hello;

import java.util.Random;

public class arryTest2 {
    public static void main(String[] args) {
        int []arr={1,2,3,4,5};
        Random random = new Random();
        for (int i = 0; i < arr.length; i++) {
            int randomIndex=random.nextInt(arr.length);
            int temp=arr[randomIndex];
            arr[randomIndex]=arr[i];
            arr[i]=temp;
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.print(" "+arr[i]);
        }
    }
}
